package cn.edu.zut.salarymanagesystem.utils;

public class TimeFormatUtils {
    public static String formatTime(String time) {
        // 提取年份、月份和日期
        String year = time.substring(0, 2);
        String month = time.substring(3, 5);
        String day = time.substring(6, 8);

        // 转换年份为四位数格式
        year = "20" + year;

        // 去除月份和日期前面的零
        if (month.startsWith("0")) {
            month = month.substring(1);
        }
        if (day.startsWith("0")) {
            day = day.substring(1);
        }

        // 组合成新的格式化时间字符串
        return year + "-" + month + "-" + day;
    }
}